/*
               File: PrcDeleteUser
        Description: Prc Delete User
             Author: GeneXus C# Generator version 10_2_5-78484
       Generated on: 6/6/2014 9:52:42.37
       Program type: Callable routine
          Main DBMS: sqlserver
*/
using System;
using System.Collections;
using GeneXus.Utils;
using GeneXus.Resources;
using GeneXus.Application;
using GeneXus.Metadata;
using System.Data;
using System.Data.SqlClient;
using GeneXus.Data;
using com.genexus;
using GeneXus.Data.ADO;
using GeneXus.Data.NTier;
using GeneXus.Data.NTier.ADO;
using System.Runtime.Remoting;
using GeneXus.WebControls;
using GeneXus.Http;
using GeneXus.Procedure;
using GeneXus.XML;
using GeneXus.Search;
using GeneXus.Encryption;
using GeneXus.Http.Client;
using System.Threading;
using System.Xml.Serialization;
using System.Data.SqlTypes;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace GeneXus.Programs {
   public class prcdeleteuser : GXProcedure
   {
      public prcdeleteuser( )
      {
         context = new GxContext(  );
         DataStoreUtil.LoadDataStores( context);
         dsDefault = context.GetDataStore("Default");
         IsMain = true;
         context.SetDefaultTheme("GeneXusXEv2");
      }

      public prcdeleteuser( IGxContext context )
      {
         this.context = context;
         IsMain = false;
         dsDefault = context.GetDataStore("Default");
      }

      public void release( )
      {
      }

      public void execute( ref long aP0_UserId )
      {
         this.AV8UserId = aP0_UserId;
         initialize();
         executePrivate();
         aP0_UserId=this.AV8UserId;
      }

      public long executeUdp( )
      {
         this.AV8UserId = aP0_UserId;
         initialize();
         executePrivate();
         aP0_UserId=this.AV8UserId;
         return AV8UserId ;
      }

      public void executeSubmit( ref long aP0_UserId )
      {
         prcdeleteuser objprcdeleteuser;
         objprcdeleteuser = new prcdeleteuser();
         objprcdeleteuser.AV8UserId = aP0_UserId;
         objprcdeleteuser.context.SetSubmitInitialConfig(context);
         objprcdeleteuser.initialize();
         ThreadPool.QueueUserWorkItem( new WaitCallback( executePrivateCatch ),objprcdeleteuser);
         aP0_UserId=this.AV8UserId;
      }

      void executePrivateCatch( object stateInfo )
      {
         try
         {
            ((prcdeleteuser)stateInfo).executePrivate();
         }
         catch ( Exception e )
         {
            GXUtil.SaveToEventLog( "Design", e);
            throw e ;
         }
      }

      void executePrivate( )
      {
         /* GeneXus formulas */
         /* Output device settings */
         /* Optimized DELETE. */
         /* Using cursor P00052 */
         pr_default.execute(0, new Object[] {AV8UserId});
         pr_default.close(0);
         dsDefault.SmartCacheProvider.SetUpdated("TBLUser") ;
         /* End optimized DELETE. */
         this.cleanup();
      }

      public void cleanup( )
      {
         context.CommitDataStores("PrcDeleteUser");
         CloseOpenCursors();
         if ( IsMain )
         {
            context.CloseConnections() ;
         }
         exitApplication();
      }

      protected void CloseOpenCursors( )
      {
      }

      public override void initialize( )
      {
         pr_default = new DataStoreProvider(context, new GeneXus.Programs.prcdeleteuser__default(),
            new Object[][] {
                new Object[] {
               }
            }
         );
         /* GeneXus formulas. */
         context.Gx_err = 0;
      }

      private long AV8UserId ;
      private IGxDataStore dsDefault ;
      private long aP0_UserId ;
      private IDataStoreProvider pr_default ;
   }

   public class prcdeleteuser__default : DataStoreHelperBase, IDataStoreHelper
   {
      public ICursor[] getCursors( )
      {
         cursorDefinitions();
         return new Cursor[] {
          new UpdateCursor(def[0])
       };
    }

    private static CursorDef[] def;
    private void cursorDefinitions( )
    {
       if ( def == null )
       {
          Object[] prmP00052 ;
          prmP00052 = new Object[] {
          new Object[] {"@AV8UserId",SqlDbType.Decimal,15,0}
          } ;
          def= new CursorDef[] {
              new CursorDef("P00052", "DELETE FROM [TBLUser]  WHERE [UserId] = @AV8UserId", GxErrorMask.GX_NOMASK | GxErrorMask.GX_MASKLOOPLOCK,prmP00052)
          };
       }
    }

    public void getResults( int cursor ,
                            IFieldGetter rslt ,
                            Object[] buf )
    {
       switch ( cursor )
       {
       }
    }

    public void setParameters( int cursor ,
                               IFieldSetter stmt ,
                               Object[] parms )
    {
       switch ( cursor )
       {
             case 0 :
                stmt.SetParameter(1, (long)parms[0]);
                break;
       }
    }

 }

}
